const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  //入口
  entry: "./src/index.ts",
  //配置出口
  output: {
    //文件夹
    path: __dirname + "/build",
    //文件子路径
    filename: "js/bundle.js",
    //
    clean: true,
  },
  mode: 'development',
  //配置 loader
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: "ts-loader",
      },
    ],
  },
  // import './abc'
  resolve: {
    extensions: [".ts", ".tsx", ".js"],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./public/index.html",
    }),
  ],
  devServer: {
    port: 3000,
    open: true,
  },
};
